import random
with open("Ip.txt",'w') as fp:
    for i in range(12000):
        fp.write(f"192.25.245.{random.randint(0,255)}\n")

with open("Ip.txt",'r') as fp:
    name = {}
    for i in fp.readlines():
        if i in name:
            name[i] += 1
        else:
            name[i] = 1
    ip_list = sorted(list(name.items()), key=lambda  x: x[1], reverse=True)[:10]
    for ip in ip_list:
        print(ip,end='\n')

import re
with open("text.txt",'r') as fp:

    text = re.sub('\W+', ' ', fp.read())  
    list_word = text.split(' ')
    # print(list_word)
    word_dict = dict()
    for word in list_word:
        if word.lower() in word_dict:
            word_dict[word.lower()] +=1
        else:
            word_dict[word.lower()] = 1
    word_sort = sorted(list(word_dict.items()),key= lambda x : x[1],reverse=True)[:10]
    for word in word_sort:
        print(word,end='\n')

